﻿/*
 *  GUI.h
 *
 *	Date: 2011-4-24
 *  Author: linshenqi
 */
 
#ifndef GUI_H_
#define GUI_H_

#include <wx/wx.h>

class MainFrame;
class GUI_Button;
class GUI_Panel;
class GUI_ComboBox;
class wgtEditor;

class MainFrame
	: public wxFrame
{
public:
	MainFrame(const wxString& title, const wxSize& size = wxDefaultSize);
	~MainFrame();
	
public:
	void EvtExit(wxCommandEvent& event);
	void EvtAbout(wxCommandEvent& event);
	
	void Init();
	void OnMotion(wxMouseEvent& event);
	
private:

//添加菜单
	wxMenuBar 	*m_pMenuBar;		//菜单栏
	wxMenu 		*m_pMenuFile;		//文件
	wxMenu 		*m_pMenuAbout;		//关于
	
//添加一个按钮
	GUI_Panel	*m_pPnl;
	
private:
	DECLARE_EVENT_TABLE()
};



//按钮
#define BMP_TYPE		3
#define BMP_UP			0
#define BMP_DOWN		1
#define BMP_OVER		2
#define BMP_PATH_UP			wxT("E:/DEVELOPMENT/WORKSPACE/SPTT/src/res/button_normal.png")
#define BMP_PATH_DOWN		wxT("E:/DEVELOPMENT/WORKSPACE/SPTT/src/res/button_active.png")
#define BMP_PATH_OVER		wxT("E:/DEVELOPMENT/WORKSPACE/SPTT/src/res/button_hover.png")

class GUI_Button
	: public wxButton
{
public:
	GUI_Button(wxWindow *pParent, int nID);
	virtual	~GUI_Button();
	
protected:
	void OnPaint(wxPaintEvent& evt);
	void OnLDown(wxMouseEvent& evt);
	void OnLUp(wxMouseEvent& evt);
	void OnEnter(wxMouseEvent& evt);
	void OnLeave(wxMouseEvent& evt);
	void OnMouseEvent(wxMouseEvent& evt);
	
public:
	void SetBMP(const wxString& sUp, const wxString& sDown, const wxString& sOver);
	void Render(wxDC *pDC = NULL);
	
private:
	wxBitmap 	*m_pBMP[BMP_TYPE];
	wxString 	m_sCaption;
	wxSize		m_Size;
	wxWindow	*m_pParent;
	double		m_fX;
	double		m_fY;
	wxBitmap	*m_pBuffer;
	wxClientDC	*m_pDstDC;
	wxMemoryDC	*m_pBufferDC;
	wxMemoryDC 	*m_pMemDC;
	
private:
	DECLARE_EVENT_TABLE()
};

#define BG		wxT("")
//面板
class GUI_Panel
	: public wxPanel
{
public:
	GUI_Panel(wxWindow *pParent);
	virtual ~GUI_Panel();
	
public:
	void Init();
	void OnPaint(wxPaintEvent& evt);

private:
	GUI_Button 		*m_pBtn[2];
	GUI_ComboBox	*m_pCmb;
	double			m_fX;
	double			m_fY;
	wxBitmap		*pBuffer;
	
	
public:
	void B1(wxCommandEvent& event);
	void B2(wxCommandEvent& event);
	
	
private:
	DECLARE_EVENT_TABLE()
};

//下拉框
class GUI_ComboBox
	: public wxComboBox
{
public:
	GUI_ComboBox(wxWindow *pParent);
	virtual ~GUI_ComboBox();
	
public:
	void OnPaint(wxPaintEvent& evt);
	
private:
	DECLARE_EVENT_TABLE()
};

//编辑框
class wgtEditor
	: public wxTextCtrl
{
public:
	wgtEditor();
	~wgtEditor();
};

#endif
